package com.team7.controller;

import com.team7.service.ShoucangCourseService;
import com.team7.vo.CommonResult;
import com.team7.vo.FavoriteVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: 1026
 * @description:
 * @author: 田宏洋
 * @create: 2021-10-26 14:56
 **/
@RestController
@RequestMapping("/core/shoucangCourse")
@Api("添加书籍的收藏操作")
public class ShouChangCourseController {
    @Resource
    private ShoucangCourseService shoucangCourseService;
    @ApiOperation("添加收藏到收藏列表中")
    @PostMapping("/addFavoritescourse")
    private CommonResult addFavoritescourse(@RequestBody FavoriteVo favoriteVo){
        return shoucangCourseService.addFavoritecourse(favoriteVo);
    }
    @ApiOperation("根据会员id以及课程id 添加收藏到收藏列表中")
    @PostMapping("/findFavoriteCourse")
    private CommonResult findFavoriteCourse(@RequestBody FavoriteVo favoriteVo){
        return shoucangCourseService.findFavoriteCourse(favoriteVo);
    }
    @ApiOperation("根据会员id以及课程id 在收藏列表中删除")
    @PostMapping("/deleteFavoriteCourse")
    private CommonResult deleteFavoriteCourse(@RequestBody FavoriteVo favoriteVo){
        return shoucangCourseService.deleteFavoriteCourse(favoriteVo);
    }
    @ApiOperation("根据会员id查看当前收藏的课程")
    @PostMapping("/findFavoriteCourseById/{memberid}")
    private CommonResult findFavoriteCourseById(@PathVariable("memberid") String memberid){
        return shoucangCourseService.findFavoriteCourseById(memberid);
    }


}
